import request from '../utils/request'
import { cached_data } from '@/utils/cache'
const api = '/StatisticsVacRank/'

const urlDateToRound = `${api}dateToRound`
/**
 * 日期转期数
 *
 * @export
 * @param {*} { date, period }
 * @return {*}
 */
export function DateToRound({ date, period }) {
  return cached_data(`${urlDateToRound}?${date},${period}`, () => request.get(urlDateToRound, {
    params: { date, period }
  }))
}
const urlRoundToDate = `${api}roundToDate`
/**
 * 期数转日期
 *
 * @export
 * @param {*} { round, period }
 * @return {*}
 */
export function RoundToDate({ round, period }) {
  return cached_data(`${urlRoundToDate}?${round},${period}`, () => request.get(urlRoundToDate, {
    params: { round, period }
  }))
}
